<template>
    <div>
        <p>{{timeDate | formatDate}}</p>
    </div>
</template>
<script>
var padDate = function(val){
    val = val<10?"0"+val:val
    return val
}
export default {
    name:"App",
    data(){
        return{
                timeDate:new Date()
        }
    },
    filters:{
        formatDate:function(val){
            console.log(this);
            console.log(val)
            console.log(val.getFullYear())
            console.log(typeof(val))
            var year = val.getFullYear();
            var mouth =padDate(val.getMonth() + 1);
            console.log(mouth)
            var day = padDate(val.getDate());
            var hour = padDate(val.getHours());
            var minutes = padDate(val.getMinutes());
            var seconds = padDate(val.getSeconds());
            console.log(day,hour,minutes,seconds);
            return year +'-'+mouth+"-"+day+" "+hour+":"+minutes+":"+seconds
            
        }
    },
    methods:{

    }
}
</script>